//
//  LZDSocketTool.h
//  LeasingPlatform
//
//  Created by 鲁征东 on 2020/6/10.
//  Copyright © 2020 柒点云. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

extern NSString * const USER_ID;
extern NSString * const LOGIN_SUCCESS;


@interface LZDSocketTool : NSObject
///注册
+(void)PostRegistWithParamer:(NSDictionary*)paramer Result:(void(^)(BaseModel*baseModel))result;
///获取登录信息
+(void)GetLoginWithParamer:(NSDictionary*)paramer UserInfo:(void(^)(LZdUserModel *userM))result;
///搜索联系人
+(void)SearchUserWithParamer:(NSDictionary*)paramer Result:(void(^)(NSArray<XZGroup*>*userList))result;

/// 获取会话列表
/// @param userId <#userId description#>
/// @param result <#result description#>
+(void)loadSessionListUserId:(NSString *)userId Result:(void(^)(NSArray<XZGroup*>*list))result;

///获取聊天记录
+(void)getChartRecords:(NSDictionary *)paramer Result:(void(^)(NSArray<ICMessage*>*list))result;

///发送消息
+(void)LZD_socketSendData:(NSDictionary*)dic;

///上传图片
+(void)UpLoadImage:(UIImage *)img Type:(NSString*)type Result:(void(^)(NSString *remoteFilePath))result;


///上传文件
+(void)UpLoadFile:(NSString *)filePath FileType:(NSString*)type Result:(void(^)(NSString *remoteFilePath))result;


@end



typedef void(^HttpUploadSuccessBlock)(id Json);
typedef void(^HttpUploadFailureBlock)(id json);
typedef void(^progressBlock)(NSProgress*_Nullable progress);
/**下载的Block*/
typedef void(^httpDownload)(NSString *_Nullable path, NSError * _Nullable error);


@interface LZD_ServerManager : NSObject

/// 设置根路径
/// @param baseURL <#baseURL description#>
+ (void)setBaseURL:(NSString *)baseURL;
// post请求
+ (void)postWithUrl: (NSString *)url Parameters: (id)parameter Success: (void (^) (id responseObject))success Failure: (void (^) (NSError *error))failure;
// get请求
+ (void)getDataGetWithUrl: (NSString *)url Parameters:(id)parameter Success: (void (^) (id responseObject))success Failure: (void (^) (NSError *error))failure;
// 上传图片
+ (void)uploadImageWithUrl: (NSString *)url Parameters: (id)parameter UploadImage :(UIImage *)uploadImage Success: (void (^) (id responseObject))success Failure: (void (^) (NSError *error))failure;
// 检测网络状态
+ (void)monitoringNetStatus: (void (^)(id))netStatus;
+ (void)uploadImageWithPath:(NSString *)path photos:(NSArray *)photos params:(NSDictionary *)params currentProgress:(progressBlock)currentProgress success:(HttpUploadSuccessBlock)success failure:(HttpUploadFailureBlock)failure;

#pragma mark -- 上传文件
+(void)uploadFileWithURL:(NSString *)url parameters:(NSDictionary *)parameters  name:(NSString *)name filePath:(NSString *)filePath success:(HttpUploadSuccessBlock)success failure:(HttpUploadFailureBlock)failure;

#pragma mark -- 下载文件
+ (void)downloadWithURL:(NSString *)url fileDir:(NSString *)fileDir progress:(progressBlock)progress callback:(httpDownload)callback;
/*取消指定URL的Http请求*/
+ (void)cancelRequestWithURL:(NSString *)url;
/*取消所有Http请求*/
+ (void)cancelAllRequest;

@end

NS_ASSUME_NONNULL_END
